<?php

class ModeloDeOrden extends Conexion {
    private $idModeloDeOrden;
    private $idOrden;
    private $clave;
    private $desc;
    
    public function __construct($idOrden, $clave, $desc) {
        $this->idOrden = $idOrden;
        $this->clave = $clave;
        $this->desc = $desc;
    }
    
    public function registrar (ModeloDeOrden $modeloOrden) {
        $this->conectar();
        
        $resul = $this->ejecutarQuery("INSERT INTO `modelodeorden`(`IDORDEN`, `CLAVE`, `DESCRIPCION`) VALUES ($modeloOrden->idOrden, '$modeloOrden->clave', '$modeloOrden->desc')");
        
        $this->desconectar();
        
        return $resul;
    }
    
    public function getIdModeloDeOrden ($idOrden, $clave) {
        $this->conectar();
                
        $query = $this->ejecutarConsulta("SELECT idmodelodeorden FROM modelodeorden WHERE idorden=$idOrden AND clave='$clave'");
        
        $row = mysql_fetch_array($query);
            
        if (!$row) {
            $this->idModeloDeOrden = 0;
        } else {
            $this->idModeloDeOrden = $row[0];
        }
        
        $idModeloDeOrden = $this->idModeloDeOrden;

        parent::desconectar();

        return $idModeloDeOrden;
    }
    
    public function getDetallesByID ($idModeloDeOrden) {
        
        $this->conectar();

        $sql = "SELECT * FROM conceptofaltante WHERE idmodelodeorden=$idModeloDeOrden";

        $sqlResult = $this->ejecutarConsulta($sql);

        $this->desconectar();

        return mysql_fetch_array($sqlResult);
    }

    public function setIdModeloDeOrden($idModeloDeOrden) {
        $this->idModeloDeOrden = $idModeloDeOrden;
    }

    public function getIdModelo() {
        return $this->idModelo;
    }

    public function setIdModelo($idModelo) {
        $this->idModelo = $idModelo;
    }

    public function getIdOrden() {
        return $this->idOrden;
    }

    public function setIdOrden($idOrden) {
        $this->idOrden = $idOrden;
    }

    public function getNumHabi() {
        return $this->numHabi;
    }

    public function setNumHabi($numHabi) {
        $this->numHabi = $numHabi;
    }

    public function getNumBorda() {
        return $this->numBorda;
    }

    public function setNumBorda($numBorda) {
        $this->numBorda = $numBorda;
    }

    public function getNumTeji() {
        return $this->numTeji;
    }

    public function setNumTeji($numTeji) {
        $this->numTeji = $numTeji;
    }

    public function getNumSeri() {
        return $this->numSeri;
    }

    public function setNumSeri($numSeri) {
        $this->numSeri = $numSeri;
    }
}
?>